home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre4.z / postgre4 / src / support / stubs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-27  |  5.5 KB  |  286 lines

  1. /*
  2.  *  stubs.c -- Stub routines for cinterface.a.  These routines are referenced
  3.  *           in the library, but should only be called inside the real
  4.  *           postgres backend.  If anyone else calls them, it's an error
  5.  *           and we should die.
  6.  */
  7.  
  8. #include "tmp/postgres.h"
  9. #include "utils/log.h"
  10. #include "rules/prs2locks.h"
  11. #include "rules/prs2stub.h"
  12. #include "utils/fmgr.h"
  13. #include "executor/tuptable.h"
  14.  
  15. RcsId ( "$Header: /private/postgres/src/support/RCS/stubs.c,v 1.29 1992/08/03 23:05:38 mao Exp $" );
  16.  
  17. ObjectId    LastOidProcessed;  /* used in real backend for qry rewrite */
  18. int NTupleProcessed;
  19.  
  20. /*
  21.  *  If you're not the real postgres backend, you don't need to dynamically
  22.  *  load code and you don't need the externally-visible symbols list (it
  23.  *  will be a GREAT day when this just goes away).
  24.  */
  25.  
  26. FList    ExtSyms[] = {
  27.     NULL, NULL
  28. };
  29.  
  30. char *
  31. RuleLockToString(locks)
  32.     RuleLock locks;
  33. {
  34.     locks = locks;
  35.     Assert(0);
  36. }
  37.  
  38. RuleLock
  39. StringToRuleLock(s)
  40.     char *s;
  41. {
  42.     s = s;
  43.     Assert(0);
  44. }
  45.  
  46. Datum GetAttributeByName() {
  47.     Assert(0);
  48. }
  49.  
  50. Datum GetAttributeByNum() {
  51.     Assert(0);
  52. }
  53.  
  54. dynamic_file_load()
  55. {
  56.     Assert(0);
  57. }
  58.  
  59. Prs2RawStub
  60. stubin(s)
  61. char *s;
  62. {
  63.     Prs2RawStub res;
  64.     long size;
  65.     int n;
  66.  
  67.     if (s == NULL || !strcmp(s, "-")) {
  68.         size = sizeof(long) + sizeof(int);
  69.         res = (Prs2RawStub) palloc(size);
  70.         VARSIZE(res) = size;
  71.         n=0;
  72.         bcopy((char *)(&n), VARDATA(res), sizeof(int));
  73.         return(res);
  74.     } else {
  75.         elog(WARN,"stubin (in backend) was called with '%s'", s);
  76.     }
  77. }
  78.  
  79. char *
  80. stubout(relstub)
  81. Prs2RawStub relstub;
  82. {
  83.     char *s;
  84.     int n;
  85.  
  86.     if (relstub==NULL) {
  87.         n = 0;
  88.     } else {
  89.         bcopy(VARDATA(relstub), (char *)(&n), sizeof(int));
  90.     }
  91.  
  92.     if (n==0) {
  93.         s = (char *) palloc(2);
  94.         s[0] = '-';
  95.         s[1] = '\0';
  96.         return(s);
  97.     } else {
  98.         elog(WARN,"stubout (in backend) was called with non-null stub");
  99.     }
  100. }
  101.  
  102. /*--------------------------------------------------------------
  103.  *
  104.  * prs2FreeLocks
  105.  *
  106.  * Yet another routine that is called from code called by backend
  107.  * but it is not included in cinterface.a because it is in a file
  108.  * with other routines that call some other routines also
  109.  * not included in cinterface.a and therefore if we include all these
  110.  * routines in cinterface.a then we might as well include all the 
  111.  * postgres routines there, which might not be such a bad idea after all
  112.  * because it will make things soooo easier, but on the other hand 
  113.  * cinterface.a will become as big as postgres and we don't want that now,
  114.  * do we?, and if you are tired reading all that... well, nobody said
  115.  * that hacking postgres was gonna be easy...
  116.  */
  117. void
  118. prs2FreeLocks(l)
  119. RuleLock l;
  120. {
  121.     if (l!=NULL) {
  122.     pfree(l);
  123.     }
  124. }
  125.  
  126. /*--------------------------------------------------------------
  127.  * prs2CopyLocks
  128.  *
  129.  * Normally, the backend wiil call this routine only with empty locks.
  130.  */
  131. RuleLock
  132. prs2CopyLocks(l)
  133. RuleLock l;
  134. {
  135.     if (prs2RuleLockIsEmpty(l)) {
  136.         return(NULL);
  137.     }
  138.  
  139.     elog(WARN, "prs2CopyLocks: Called from backend with NON null lock");
  140. }
  141.  
  142. RuleLock
  143. prs2RemoveAllLocksOfRule(locks, ruleId)
  144.     RuleLock locks;
  145.     ObjectId ruleId;
  146. {
  147.     locks = locks;
  148.     ruleId = ruleId;
  149.     Assert(0);
  150. }
  151.  
  152. RuleLock
  153. prs2LockUnion(lock1, lock2)
  154.     RuleLock lock1;
  155.     RuleLock lock2;
  156. {
  157.     lock1 = lock1;
  158.     lock2 = lock2;
  159.     Assert(0);
  160. }
  161.  
  162. /*-----------------------------------------------------------------
  163.  * create an emtpy lock
  164.  */
  165. RuleLock
  166. prs2MakeLocks()
  167. {
  168.     RuleLock t;
  169.  
  170.     t = (RuleLock) palloc(sizeof(Prs2LocksData));
  171.  
  172.     if (t==NULL) {
  173.     elog(WARN, "prs2MakeLocks (stub version): palloc failed.");
  174.     }
  175.  
  176.     t->numberOfLocks = 0;
  177.     return(t);
  178. }
  179.  
  180. /* ----------------
  181.  *    be_portalinit() is called from postinit.c and pqtest() is
  182.  *    a backend builtin.  these have no meaning to the cinterface
  183.  *    support programs.
  184.  * ----------------
  185.  */
  186. void
  187. be_portalinit()
  188. {
  189. }
  190.  
  191. int32
  192. pqtest()
  193. {
  194.     return 1;
  195. }
  196. List StringToPlanWithParams()
  197. {
  198.     elog(FATAL, "StringToPlanWithParams: called stubbed routine");
  199.     return LispNil;        /* make lint happy */
  200. }
  201. int prs2RunOnePlanAndGetValue()
  202. {
  203.     elog(FATAL, "prs2RunOnePlanAndGetValue: called stubbed routine");
  204.     return 0;           /* make lint happy */
  205. }
  206.  
  207. int paradj_nextpage(page,dir)
  208. int page,dir;
  209. {
  210.     elog(FATAL, "paradj_nextpage: called stubbed routine");
  211.     return 0;           /* make lint happy */
  212. }
  213.  
  214. TupleTable
  215. ExecCreateTupleTable()
  216. {
  217.     elog(FATAL, "ExecCreateTupleTable: called stubbed routine");
  218.     return 0;           /* make lint happy */
  219. }
  220.  
  221. void
  222. ExecDestroyTupleTable()
  223. {
  224.     elog(FATAL, "ExecDestroyTupleTable: called stubbed routine");
  225. }
  226.  
  227. Pointer
  228. ExecGetTableSlot(table, slotnum)
  229. {
  230.     elog(FATAL, "ExecGetTableSlot: called stubbed routine");
  231.     return 0;           /* make lint happy */
  232. }
  233.  
  234. int
  235. ExecAllocTableSlot()
  236. {
  237.     elog(FATAL, "ExecAllocTableSlot: called stubbed routine");
  238.     return 0;           /* make lint happy */
  239. }
  240.  
  241. bool
  242. ExecQual()
  243. {
  244.     elog(FATAL, "ExecQual: called stubbed routine");
  245. }
  246.  
  247. void
  248. Async_NotifyAtCommit()
  249. {
  250.     elog(FATAL, "Async_NotifyAtCommit: called stubbed routine");
  251. }
  252.  
  253. List
  254. typeid_get_relid()
  255. {
  256.     elog(FATAL, "typeid_get_relid: called stubbed routine");
  257. }
  258.  
  259. List
  260. pg_plan()
  261. {
  262.     elog(FATAL, "pg_plan: called stubbed routine");
  263. }
  264.  
  265. ObjectId *
  266. funcname_get_funcargtypes ( function_name )
  267.      char *function_name;
  268. {
  269.     elog(FATAL, "funcname_get_funcargtypes: called stubbed routine");     
  270. }
  271.  
  272. bool
  273. pg_checkretval( typeid, parselist )
  274.     ObjectId typeid;
  275.     List parselist;
  276. {
  277.     elog(FATAL, "pg_checkretval: called stubbed routine");
  278. }
  279.  
  280. bool    VacuumRunning = false;
  281. void
  282. vc_abort()
  283. {
  284.     elog(FATAL, "vc_abort: called stubbed routine");
  285. }
  286.